# -*- coding:utf-8 -*-
from typing import Callable
from fastapi import FastAPI
from database.mysql import register_mysql


def startup(app: FastAPI) -> Callable:
    """
    FastApi 启动完成事件
    :param app: FastAPI
    :param scheduler:
    :return: start_app
    """

    async def app_start() -> None:
        # 注册数据库
        await register_mysql(app)

    return app_start


def stopping(app: FastAPI) -> Callable:
    """
    FastApi 关闭事件
    :param app: FastAPI
    :return: stop_app
    """

    async def app_stop() -> None:
        pass

    return app_stop
